<%@include file="../common/head.jsp" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<script type="text/javascript">
	document.title = "注册";
	function doRegister(){
		window.location.href='gotoRegister.jspx';
	}
	
	$(document).ready(function(){
		$('#username').blur(function(){
			var name_temp = $('#username').val();
			if($.trim(name_temp) == ""){
				return false;
			}
			$.ajax({
				type:'post',
				url:'/checkUsername?username='+name_temp,
				success:function(data){
					if(data == 'available'){
						$('#flag_true').show();
					} else {
						$('#flag_false').show();
					}
				}
			});
		});
		$('#username').focus(function(){
			$('#flag_false').hide();
			$('#flag_true').hide();
		});
	});
</script>

	<form:form class="form-signin" action="/register" method="post" modelAttribute="dto">
		<h2 class="form-signin-heading">注册</h2>
	<table>
	<tr>
		<td>
		<form:input path="username" placeholder="username" class="input-block-level"/>
		<span id="flag_true" style="color: green;display: none;">available</span>
		<span id="flag_false" style="color: red;display: none;">unavailable</span>
		</td>
		<td>
		<form:errors path="username" cssClass="text-error"></form:errors>
		</td>
	</tr>
	<tr>
		<td>
		<form:password path="password" class="input-block-level" placeholder="Passwaord"/><br/>
		</td>
		<td>
		<form:errors path="password" cssClass="text-error"></form:errors>
		</td>
	</tr>
	<tr>
		<td>
		<form:input path="email" placeholder="Email" class="input-block-level"/>
		</td>
		<td>
		<form:errors path="email" cssClass="text-error"></form:errors>
		</td>
	</tr>
	<tr>	
		<th>
		<input type="submit" value="submit" class="btn btn-primary btn-small"/>&nbsp;&nbsp;
		<input type="reset" value="reset"  class="btn btn-primary btn-small"/>
		</th>
	</tr>	
	</table>
	</form:form>
</div>	
</body>
</html>